﻿using FineAdmin.IService;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace HuiJi.CMS.Blog.Controllers
{
    public class TipController : BaseController
    {
        // GET: Tip
        public IPostCategoryService PostCategoryService { get; set; }
        public IPostsService PostsService { get; set; }

        public ActionResult Index(int? CId, int p = 1, int l = 10)
        {
            ViewBag.Active = "Tip";
            ViewBag.CId = CId;

            ViewBag.PostCategoryList = PostCategoryService.GetAll();
            ViewBag.Page = p;
            int total;
            ViewBag.PostsList = PostsService.GetListByFilter(new FineAdmin.Model.PostsModel()
            {

                Post_Type = CId,
                State = 1

            }, new FineAdmin.Model.PageInfo()
            {
                limit = l,
                page = p
            }, out total);
            ViewBag.Total = total;
            return View();
        }

        public ActionResult TipDetail(int Id)
        {
            ViewBag.Active = "Tip";
            var data = PostsService.GetById(Id);
            return View(data);
        }
    }
}